package com.yuntsg.nnsfcp.service.front.ut;

import com.yuntsg.nnsfcp.front.entity.Wosdetail;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * 多线程队列
 *
 * @author ：ljx
 * @date ：Created in 2019/9/2
 */
public class QueueUtil implements Serializable {

    private static Queue<Wosdetail> queue = new LinkedList<>();

    private QueueUtil() {
    }

    public static Wosdetail get() {
        if (queue.size() > 0) {
            return queue.poll();
        }
        return null;
    }

    public static void set(List<Wosdetail> coll) {
        if (coll != null && coll.size() > 0) {
            for (Wosdetail t : coll) {
                queue.offer(t);
            }
        }
    }

    public static void set(Wosdetail t) {
        queue.offer(t);
    }

    public static Integer getSize() {
        return queue.size();
    }

}
